<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>部门管理</title>
<!--                       CSS                       -->
<!-- Reset Stylesheet -->
<link rel="stylesheet" href="/oa/css/reset.css" type="text/css" media="screen" />
<!-- Main Stylesheet -->
<link rel="stylesheet" href="/oa/css/styleMain.css" type="text/css" media="screen" />
<!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
<link rel="stylesheet" href="/oa/css/invalid.css" type="text/css" media="screen" />
<!--                       Javascripts                       -->
<script type="text/javascript" src="/oa/js/datePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/oa/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/oa/js/myDate.js"></script>
<script type="text/javascript">
function findByDepartName(){
		departName = $("#departName").val();
		$("#info").val("请选择");
		$("branchName").val("部门所属机构");
		$("#name").val("姓名")
		$("#parameters").hide();
		$("#search").show(); 
	}
function findByInfo(){
		if($("#info").val()==""){
			$("#parameters").hide();
			$("#search").show();
			$("#parameters").val("");
		}else{
			textValues=$("#info").val();
			$("#parameters").show();
			$("#search").show();
			$("#parameters").val("");
		}
	}
	$(document).ready(function(e) {
        $("#checkAll").click(function(){
			$("body :checkbox").attr("checked",$("#checkAll").attr("checked"));
		});
		$("#btnDel").click(function(){
			var form = document.forms[0];
			form.action = '<s:url namespace="/page/permanage" action="deleteDepart" />';
			form.submit();
		});
		
    });
</script>
</head>
<body>
<div>
  <!-- Wrapper for the radial gradient background -->
  <div>
    <!-- Main Content Section with everything -->
    <div class="clear"></div>
    <!-- End .clear -->
    <div class="content-box">
      <!-- Start Content Box -->
      <div class="content-box-header">
        <h3>部门管理</h3>
         <ul class="content-box-tabs">
          <li><a href="#tab1" class="default-tab">浏览</a></li>
          <li><a href="/oa/page/permanage/addDepart.jsp">新增</a></li>
        </ul>
        <div class="clear"></div>
      </div>
      <!-- End .content-box-header -->
      <div class="content-box-content">
         <div class="tab-content default-tab" id="tab1">
       <!--搜索框-->
        <div class="searchPanel"><br />
          <label>请选择搜索类别：</label>
          <select id="departName" onchange="findByDepartName()">
            <option value="depart">部门</option>
          </select>&nbsp;
          <select id="info" onchange="findByInfo()">
            <option selected="selected">请选择</option>
            <option value="branchName">部门所属机构</option>
            <option value="name">部门联系人</option>
</select>&nbsp;
         <input id="parameters" type="text"/>&nbsp;
         <input id="search" class="button" type="submit" value="搜一下" /><br /><br />
          </div>
       <table>
       <s:form namespace="/page/permanage" action="listDepart" id="departForm">
         <s:fielderror></s:fielderror>
			<s:hidden name="currentpage"></s:hidden>
            <thead>
              <tr>
                <th><input class="check-all" type="checkbox" id="checkAll" />全选&nbsp;&nbsp;<input type="button" value="批量删除" id="btnDel" /></th>
                <th>部门编号</th>
                <th>部门名称</th>
                <th>所属机构</th>
                <th>部门联系人</th>
                <th>联系号码</th>
                <th>移动电话</th>
                <th>传真</th>
                <th>操作</th>
              </tr>
            </thead>
            <tbody>
             <s:iterator value="pageView.records" status="entry">
              <tr>
                <td height="35"><input type="checkbox" class="check-all" value="${id}" /></td>
                <td>${id}</td>
                <td>${name}</td>
                <td>${branch.name}</td>
                <td>${principalUser.userName}</td>
                <td>${telphone}</td>
                <td>${moblephone}</td>
                <td>${faxes}</td>
                <td>
                  <img onclick="location.href='<s:url action="showDepart" namespace="/page/permanage"><s:param name="depart.id" value="departId"/></s:url>'" 
                       title="编辑" src="/oa/images/bt_edit.gif" alt="Edit" />
                &nbsp;&nbsp;&nbsp;
                  <img onclick="deleteDepart('${id}','${name}')" title="删除" src="/oa/images/bt_del.gif" alt="Delete" />
                </td>
              </tr>
              </s:iterator>
            </tbody>
            <tfoot>
              <tr>
                <td colspan="9">
                  <div class="pagination align-right"><s:include value="/oa/page/share/paging.jsp"></s:include></div>
                  <div class="clear"></div>
                </td>
              </tr>
            </tfoot>
            </s:form>
          </table>
        </div>
        <!-- End #tab1 -->
      </div>
      <!-- End .content-box-content -->
    </div>
  </div>
  <!-- End #main-content -->
</div>
</body>
</html>
